package com.dhcc.DRGsHosp.facade.impl.assembler;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.dhcc.DRGsHosp.core.domain.KeyDisGroup;
import com.dhcc.DRGsHosp.facade.dto.KeyDisGroupDTO;

public class KeyDisGroupAssembler {
	
	public static KeyDisGroupDTO  toDTO(KeyDisGroup  keyDisGroup){
		
		if (keyDisGroup == null) {
			return null;
		}
		KeyDisGroupDTO result  = new KeyDisGroupDTO();
		result.setRole(keyDisGroup.getRole());
    	result.setUser(keyDisGroup.getUser());
    	result.setDrgCode(keyDisGroup.getDrgCode());
    	result.setMdcCode(keyDisGroup.getMdcCode());
    	result.setDepCode(keyDisGroup.getDepCode());
    	result.setYears(keyDisGroup.getYears());
    	result.setCaseCntPer(keyDisGroup.getCaseCntPer());
    	result.setWeightPer(keyDisGroup.getWeightPer());
    	result.setMdcWeightPer(keyDisGroup.getMdcWeightPer());
    	result.setHospCode(keyDisGroup.getHospCode());
 	    return result;
	 }
	
	public static List<KeyDisGroupDTO>  toDTOs(Collection<KeyDisGroup>  keyDisGroups){
		if (keyDisGroups == null) {
			return null;
		}
		List<KeyDisGroupDTO> results = new ArrayList<KeyDisGroupDTO>();
		for (KeyDisGroup each : keyDisGroups) {
			results.add(toDTO(each));
		}
		return results;
	}
	
	 public static KeyDisGroup  toEntity(KeyDisGroupDTO  keyDisGroupDTO){
	 	if (keyDisGroupDTO == null) {
			return null;
		}
	 	KeyDisGroup result  = new KeyDisGroup();
	 	result.setRole(keyDisGroupDTO.getRole());
    	result.setUser(keyDisGroupDTO.getUser());
	 	result.setDrgCode(keyDisGroupDTO.getDrgCode());
    	result.setMdcCode(keyDisGroupDTO.getMdcCode());
    	result.setDepCode(keyDisGroupDTO.getDepCode());
    	result.setYears(keyDisGroupDTO.getYears());
    	result.setCaseCntPer(keyDisGroupDTO.getCaseCntPer());
    	result.setWeightPer(keyDisGroupDTO.getWeightPer());
    	result.setMdcWeightPer(keyDisGroupDTO.getMdcWeightPer());
    	result.setHospCode(keyDisGroupDTO.getHospCode());
 	  	return result;
	 }
	
	public static List<KeyDisGroup> toEntities(Collection<KeyDisGroupDTO> keyDisGroupDTOs) {
		if (keyDisGroupDTOs == null) {
			return null;
		}
		
		List<KeyDisGroup> results = new ArrayList<KeyDisGroup>();
		for (KeyDisGroupDTO each : keyDisGroupDTOs) {
			results.add(toEntity(each));
		}
		return results;
	}
}
